﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Customer.aspx.cs" Inherits="Register" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div>
    <a id="A1" href="Insert Customer.aspx" runat="server" style="color: #FF0000">Add Customer</a>
    <asp:GridView ID="GridView1" runat="server" DataKeyNames="Identification" AutoGenerateEditButton ="true" AutoGenerateColumns ="false"
     OnRowEditing ="EditRecord" OnRowCancelingEdit="CancelRecord" OnRowDeleting="DeleteRecord" OnRowUpdating="UpdateRecord">
    <HeaderStyle BackColor ="LightBlue" ForeColor="White" />
    <EditRowStyle BackColor ="Aqua" />
    <SelectedRowStyle BackColor="Cyan" />
    <Columns>
        <asp:TemplateField HeaderText="Identification">
            <ItemTemplate><%# Eval("Identification")%></ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtIdentification" runat="server" Text='<%# Eval("Identification")%>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="First name">
            <ItemTemplate><%# Eval("Firstname")%></ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtFirstname" runat="server" Text='<%# Eval("Firstname")%>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Last name">
            <ItemTemplate><%# Eval("Lastname")%></ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtLastname" runat="server" Text='<%# Eval("Lastname")%>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Age">
            <ItemTemplate><%# Eval("Age")%></ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtAge" runat="server" Text='<%# Eval("Age")%>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Address">
            <ItemTemplate><%# Eval("Address")%></ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtAddress" runat="server" Text='<%# Eval("Address")%>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Phonenumber">
            <ItemTemplate><%# Eval("Phonenumber")%></ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtPhonenumber" runat="server" Text='<%# Eval("Phonenumber")%>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Email">
            <ItemTemplate><%# Eval("Email")%></ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtEmail" runat="server" Text='<%# Eval("Email")%>'></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Delete">
            <ItemTemplate>
                <span onclick='return confirm("Do you want to delete record?")'>
                    <asp:LinkButton ID="linkDelete" runat ="server" CommandName="Delete" Text="Delete"></asp:LinkButton>
                </span>
            </ItemTemplate>
        </asp:TemplateField>

    </Columns>
    </asp:GridView>
    <asp:Label ID="LResult" runat="server"></asp:Label>
    </div>
</asp:Content>

